package pl.lodz.p.browarex.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import pl.lodz.p.browarex.base.BaseCrudDao;
import pl.lodz.p.browarex.model.AnalysisType;

@Repository
public class AnalysisTypeDAO extends BaseCrudDao<AnalysisType, Long> {

	public AnalysisTypeDAO(Class<AnalysisType> type) {
		super(type);
	}

	public AnalysisTypeDAO() {
		super(AnalysisType.class);
	}

	public AnalysisType loadByCustomerID(String customerID) {
		Criteria criteria = getSession().createCriteria(type);
		criteria.add(Restrictions.eq("customerID", customerID));
		return (AnalysisType) criteria.uniqueResult();
	}

}
